package cn.sumpu.app.coolsk.domain;

import java.io.Serializable;
import java.text.ParseException;
import java.util.Date;

import org.apache.commons.lang.StringUtils;

import cn.sumpu.toolkit.common.util.Common;

public class TicketPrice implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1173430381374764437L;
	private String ticketId;
	private String spDate;
	private Double priceA;
	private Double priceC;
	private String creator;
	private String updater;
	private Date gmtCreated = new Date();
	private Date gmtModified = new Date();
	private Boolean priceComHas ;
	
	public String getWeek(){
		String weekday = null;
		if(!Common.empty(spDate)){
			try {
				weekday = Common.getWeekDay(Common.parseDate(spDate,"yyyy-MM-dd"));
			} catch (ParseException e) {
				e.printStackTrace();
			}
		}
		
		return weekday;
	}
	public String getTicketId() {
		return ticketId;
	}
	public void setTicketId(String ticketId) {
		this.ticketId = ticketId;
	}
	public String getSpDate() {
		return spDate;
	}
	public void setSpDate(String spDate) {
		this.spDate = spDate;
	}
	public Double getPriceA() {
		return priceA;
	}
	public void setPriceA(Double priceA) {
		this.priceA = priceA;
	}
	public Double getPriceC() {
		return priceC;
	}
	public void setPriceC(Double priceC) {
		this.priceC = priceC;
	}
	public String getCreator() {
		return creator;
	}
	public void setCreator(String creator) {
		this.creator = creator;
	}
	public String getUpdater() {
		return updater;
	}
	public void setUpdater(String updater) {
		this.updater = updater;
	}
	public Date getGmtCreated() {
		return gmtCreated;
	}
	public void setGmtCreated(Date gmtCreated) {
		this.gmtCreated = gmtCreated;
	}
	public Date getGmtModified() {
		return gmtModified;
	}
	public void setGmtModified(Date gmtModified) {
		this.gmtModified = gmtModified;
	}
    public Boolean getPriceComHas() {
        return priceComHas;
    }
    public void setPriceComHas(Boolean priceComHas) {
        this.priceComHas = priceComHas;
    }
    @Override
    public boolean equals(Object obj) {
        if(obj != null){ 
            if(!super.equals(obj)){ 
                if(obj instanceof TicketPrice){
                    TicketPrice tp = (TicketPrice) obj;
                    if(!StringUtils.isEmpty(spDate) && !StringUtils.isEmpty(ticketId) && !StringUtils.isEmpty(tp.getSpDate()) && !StringUtils.isEmpty(tp.getTicketId())){
                        return spDate.equals(tp.getSpDate()) && ticketId.equals(tp.getTicketId());
                    }
                }
                
            }
            
        }
        return super.equals(obj);
    }
	
	
}
